package com.mindata.blockchain.core.manager;

import com.mindata.blockchain.core.model.TicketEntity;
import com.mindata.blockchain.core.repository.MessageRepository;
import com.mindata.blockchain.core.repository.TicketRepository;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 王鹏
 */
@Component
public class TicketManager {
    @Resource
    private TicketRepository ticketRepository;

    public List<TicketEntity> findAll(Integer status) {
        return ticketRepository.findAllByStatus(status);
    }

    public List<TicketEntity> findAllTicket() {
        return ticketRepository.findAll();
    }

    public TicketEntity findOne() {
        return ticketRepository.findAll().get(0);
    }

    public TicketEntity findByTicketId(String ticketId) {
        return ticketRepository.findByMessageId(ticketId);
    }

}
